﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Windows;
using System.Windows.Input;

namespace PersonaLibrary.View
{
	public static class CloseCommandAttached
	{
		public static readonly DependencyProperty CloseCommandProperty = DependencyProperty.RegisterAttached("CloseCommand", typeof(RelayCommand),
			typeof(CloseCommandAttached));

		public static RelayCommand GetCloseCommand(UIElement element)
		{
			if(element is Window)
			{
				RelayCommand result = new RelayCommand(x => ((Window)element).Close(), x => true);

				return result;
			}

			return null;
		}
	}
}
